<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>条件学习</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.12"></script>
</head>

<body>
    <div id="app">
        <!-- <h1 v-if="show">这个是对的</h1>
        <h1 v-else>这个是假的</h1> -->
        <span>————————————————————————————————</span>
        <div>
            <input type="radio" name="q1" v-model="q" value="1">想吃的东西
            <input type="radio" name="q2" v-model="q" value="2">在玩游戏
            <div v-if="q==2">
                [水果]:<select>
                    <option>西瓜</option>
                    <option>榴莲</option>
                    <option>樱桃</option>
                </select>
            </div>
            <div v-else>
                [游戏列表]:<select>
                    <option>gogo</option>
                    <option>战地</option>
                    <option>LOL</option>
                </select>
            </div>
        </div>

    </div>
    <script>
        var app = new Vue({
            el: "#app",
            data: {
                show: 1,
                q: 1,

                a: [1, 2, 3, 4].forEach(console.log),  //1.foreach方法
                
            },

        });

    </script>



</body>

<ml>